Conversation
"HeaderOverlayColor", "HeaderOverlayOpacity", "HeaderOverlayGradientDirection", "HeaderColorIndexInLightMode", "HeaderColorIndexInDarkMode", "FooterAlignment", "FooterOverlayColor", "FooterOverlayOpacity", "FooterOverlayGradientDirection", "FooterColorIndexInLightMode", "FooterColorIndexInDarkMode", "FontOptionForSiteTitle", "FontOptionForSiteNav", "FontOptionForSiteFooterTitle", "FontOptionForSiteFooterNav", still to be implemented: "FooterBackgroundImageUrl", "FooterBackgroundImageFocalPoint", "BackgroundImageUrl"
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1691 +/- ##
==========================================
- Coverage 82.42% 81.25% -1.17%
==========================================
Files 416 637 +221
Lines 28590 45266 +16676
Branches 0 4750 +4750
==========================================
+ Hits 23565 36783 +13218
- Misses 5025 7087 +2062
- Partials 0 1396 +1396 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR extends the SharePoint branding/chrome APIs in PnP.Core to support the newer “modern” header/footer options (overlay colors/opacity/gradient direction, color indexes, footer alignment), adds support for site font chrome configuration, and introduces APIs to list/apply available font packages (OOB, site, branding center).
Changes:
- Added new enums and properties to represent modern header/footer overlay settings and footer link alignment.
- Added font chrome models (
IFontOptions/IFontOption) and wired them into chrome get/set flows. - Added
IBrandingManagerAPIs and internal implementation to list/apply font packages and to support footer background images.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/OverlayGradientDirectionType.cs | Adds gradient direction enum for overlay options. |
| src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/OverlayColorType.cs | Adds overlay color enum used by header/footer chrome. |
| src/sdk/PnP.Core/Model/SharePoint/Core/Public/Enums/FooterLinkAlignment.cs | Adds footer link alignment enum for modern footer. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IHeaderOptions.cs | Exposes new modern header overlay/color index properties. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFooterOptions.cs | Exposes new modern footer overlay/alignment properties + footer background image APIs. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontPackage.cs | Introduces font package model for font package endpoints. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontOptions.cs | Introduces site font chrome configuration contract. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IFontOption.cs | Introduces font option contract used in chrome payload. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IChromeOptions.cs | Adds Font section to chrome options. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Public/IBrandingManager.cs | Adds public APIs for listing/applying font packages. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/HeaderOptions.cs | Implements new header overlay properties; relaxes header background-image restriction. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FooterOptions.cs | Implements new footer overlay properties + footer background-image support. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontPackage.cs | Internal implementation for IFontPackage. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontOptions.cs | Internal implementation for IFontOptions. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/FontOption.cs | Internal implementation for IFontOption. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/Enums/SiteLogoType.cs | Adds FooterBackground site logo type for SiteIconManager calls. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/ChromeOptions.cs | Wires Font options into internal chrome options model. |
| src/sdk/PnP.Core/Model/SharePoint/Branding/Internal/BrandingManager.cs | Loads modern chrome values from AllProperties, serializes them into SetChromeOptions payload, and adds font package endpoints support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public LogoAlignment LogoAlignment { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Specifies the available overlay color types that can be applied to header or footer. | ||
| /// </summary> | ||
| public OverlayColorType OverlayColor { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the opacity level of the overlay [0-100]. | ||
| /// </summary> | ||
| public int OverlayOpacity { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines the possible directions for an overlay gradient layout. | ||
| /// </summary> | ||
| public OverlayGradientDirectionType OverlayGradientDirection { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// seesm to be alays -1 | ||
| /// </summary> | ||
| public int ColorIndexInLightMode { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// seesm to be alays -1 | ||
| /// </summary> | ||
| public int ColorIndexInDarkMode { get; set; } |
| /// seesm to be alays -1 | ||
| /// </summary> | ||
| public int ColorIndexInLightMode { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// seesm to be alays -1 |
| // => modern Header does allow background images for all layouts | ||
| //if (Layout != HeaderLayoutType.Extended) | ||
| //{ | ||
| // throw new ClientException(ErrorType.Unsupported, PnPCoreResources.Exception_Unsupported_BackgroundImageHeaderIsNotOfTypeExtended); | ||
| //} |
| public string DisplayName { get; set; } | ||
|
|
||
| public FooterLinkAlignment LinkAlignment { get; set; } | ||
| public OverlayColorType OverlayColor { get; set; } | ||
| public int OverlayOpacity { get; set; } | ||
| public OverlayGradientDirectionType OverlayGradientDirection { get; set; } | ||
| public int ColorIndexInLightMode { get; set; } | ||
| public int ColorIndexInDarkMode { get; set; } |
| /// seesm to be alays -1 | ||
| /// </summary> | ||
| int ColorIndexInLightMode { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// seesm to be alays -1 |
| if (web.AllProperties.Values.TryGetValue("FontOptionForSiteTitle", out var FontOptionForSiteTitle) | ||
| | web.AllProperties.Values.TryGetValue("FontOptionForSiteNav", out var FontOptionForSiteNav) | ||
| | web.AllProperties.Values.TryGetValue("FontOptionForSiteFooterTitle", out var FontOptionForSiteFooterTitle) | ||
| | web.AllProperties.Values.TryGetValue("FontOptionForSiteFooterNav", out var FontOptionForSiteFooterNav)) | ||
| { | ||
| if(!string.IsNullOrWhiteSpace(FontOptionForSiteTitle?.ToString())) | ||
| { | ||
| chromeOptions.Font.SiteTitle = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteTitle.ToString()); | ||
| } | ||
| if (!string.IsNullOrWhiteSpace(FontOptionForSiteNav?.ToString())) | ||
| { | ||
| chromeOptions.Font.SiteNav = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteNav.ToString()); | ||
| } | ||
| if (!string.IsNullOrWhiteSpace(FontOptionForSiteFooterTitle?.ToString())) | ||
| { | ||
| chromeOptions.Font.SiteFooterTitle = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteFooterTitle.ToString()); | ||
| } | ||
| if (!string.IsNullOrWhiteSpace(FontOptionForSiteFooterNav?.ToString())) | ||
| { | ||
| chromeOptions.Font.SiteFooterNav = JsonSerializer.Deserialize<FontOption>(FontOptionForSiteFooterNav.ToString()); | ||
| } | ||
| } |
| footerColorIndexInLightMode = chromeOptions.Footer != null ? chromeOptions.Footer.ColorIndexInLightMode : -1, | ||
| footerColorIndexInDarkMode = chromeOptions.Footer != null ? chromeOptions.Footer.ColorIndexInDarkMode : -1, | ||
| fontOptionForSiteTitle = chromeOptions.Font != null ? chromeOptions.Font.SiteTitle : null, | ||
| fontOptionForSiteNav = chromeOptions.Font != null ? chromeOptions.Font.SiteNav : null, | ||
| fontOptionForSiteFooterTitle = chromeOptions.Font != null ? chromeOptions.Font.SiteFooterTitle : null, | ||
| fontOptionForSiteFooterNav = chromeOptions.Font != null ? chromeOptions.Font.SiteFooterNav : null, | ||
| }; |
| public async Task<List<IFontPackage>> GetOutOfBoxFontPackagesAsync() | ||
| { | ||
| var batch = context.NewBatch(); | ||
| var fontPackages = await GetOutOfBoxFontPackagesBatchAsync(batch).ConfigureAwait(false); | ||
| await context.ExecuteAsync(batch).ConfigureAwait(false); | ||
| return fontPackages.Result; | ||
| } | ||
|
|
||
| public List<IFontPackage> GetOutOfBoxFontPackages() | ||
| { | ||
| return GetOutOfBoxFontPackagesAsync().GetAwaiter().GetResult(); | ||
| } | ||
|
|
||
| public async Task<IBatchSingleResult<List<IFontPackage>>> GetOutOfBoxFontPackagesBatchAsync(Batch batch) | ||
| { | ||
| ApiCall apiCall = BuildGetOutOfBoxFontPackagesApiCall(); | ||
| return await GetFontPackagesBatchAsync(batch, apiCall).ConfigureAwait(false); | ||
| } |
| /// specifies the alignment of links in the footer | ||
| /// </summary> | ||
| public enum FooterLinkAlignment | ||
| { | ||
| /// <summary> | ||
| /// Right alignment ( Value = 0 ) | ||
| /// </summary> | ||
| Right = 0, | ||
| /// <summary> | ||
| /// Left alignment ( Value = 2 ) | ||
| /// </summary> | ||
| Left = 2, |
| /// <summary> | ||
| /// dont show this font in the font picker | ||
| /// </summary> | ||
| bool IsHidden { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// IsValid | ||
| /// </summary> | ||
| bool IsValid { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// json-string containg settings for the font package | ||
| /// </summary> | ||
| string PackageJson { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 0 = Branding Center, 1 = out of the box font | ||
| /// </summary> | ||
| int Store { get; set; } |
@jansenbe implementation of #1690
Support for new Header and Footer settings
Support to Get available fonts in Branding Manager from Site, OutOfBox, Branding Center (Organization)
Support to Set Font to Site in Branding Manager for OutOfBox and Branding Center Fonts (Organization)
The Chrome properties are reflected as WebProperties:
"HeaderOverlayColor",
"HeaderOverlayOpacity",
"HeaderOverlayGradientDirection",
"HeaderColorIndexInLightMode",
"HeaderColorIndexInDarkMode",
"FooterAlignment",
"FooterOverlayColor",
"FooterOverlayOpacity",
"FooterOverlayGradientDirection",
"FooterColorIndexInLightMode",
"FooterColorIndexInDarkMode",
"FontOptionForSiteTitle",
"FontOptionForSiteNav",
"FontOptionForSiteFooterTitle",
"FontOptionForSiteFooterNav",
"FooterBackgroundImageUrl",
"FooterBackgroundImageFocalPoint",
"BackgroundImageUrl"
But have to be set as /_api/web/SetChromeOptions
{
"headerLayout": 4,
"headerEmphasis": 2,
"megaMenuEnabled": true,
"footerEnabled": true,
"footerLayout": 0,
"footerEmphasis": 0,
"hideTitleInHeader": false,
"logoAlignment": 1,
"footerAlignment": 0,
"footerOverlayColor": -1,
"footerOverlayOpacity": 0,
"footerOverlayGradientDirection": 0,
"headerOverlayColor": 1,
"headerOverlayOpacity": 54,
"headerOverlayGradientDirection": 0,
"fontOptionForSiteTitle": null,
"fontOptionForSiteNav": null,
"fontOptionForSiteFooterTitle": null,
"fontOptionForSiteFooterNav": null,
"horizontalQuickLaunch": true,
"headerColorIndexInLightMode": -1,
"headerColorIndexInDarkMode": -1,
"footerColorIndexInLightMode": -1,
"footerColorIndexInDarkMode": -1
}